package com.group.dao;

import org.junit.Test;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import com.group.pojo.Common;

public class CommonDaoText {

	@Test
	public void testGetTbCurrentDateMaxId() throws Exception {
		ApplicationContext ac = new ClassPathXmlApplicationContext("conf/applicationContext.xml");
		CommonMapper commonMapper = ac.getBean(CommonMapper.class);
		
		Common common = new Common();
		common.setTbName("tb_user");
		common.setDate("20171010");
		String maxId = commonMapper.getTbCurrentDateMaxId(common);
		System.out.println(maxId);
	}
	
	@Test
	public void testGetColumnNameByIdAndTbName() throws Exception {
		ApplicationContext ac = new ClassPathXmlApplicationContext("conf/applicationContext.xml");
		CommonMapper commonMapper = ac.getBean(CommonMapper.class);
		
		Common common = new Common("20171011000001", "role_name", "tb_role");
		String resultName = commonMapper.getColumnNameByIdAndTbName(common);
		System.out.println(resultName);
	}
	
}
